package com.example.elm.Account

import android.app.Activity
import android.os.Build
import java.io.Serializable

class CommonUtil {
    // 伴生类，相当于静态函数
    companion object{
        fun <T : Serializable?> getSerializable(activity: Activity, name: String, clazz: Class<T>): T
        {
            return if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU)
                activity.intent.getSerializableExtra(name, clazz)!!
            else
                activity.intent.getSerializableExtra(name) as T
        }
    }

}